package com.example.demo.RabbitMQTest.entity;

import com.example.demo.RabbitMQTest.util.MQConstant;
import lombok.Data;

import java.util.Date;

/**
 * @create: 2021-01-20 14:16
 **/
@Data
public class QueueMessage {

    public QueueMessage() {
        super();
    }


    public QueueMessage(String queueName, String message) {
        super();
        this.queueName = queueName;
        this.message = message;
        this.exchange = MQConstant.DEFAULT_DIRECT_EXCHANGE_NAME;
        this.type = 1;
        this.group = 10;
        this.timestamp = new Date();
        this.status = 10;
    }


    public QueueMessage(String exchange, String queueName, Integer type, Integer group, String message, Integer status) {
        super();
        this.queueName = queueName;
        this.type = type;
        this.exchange = exchange;
        this.group = group;
        this.message = message;
        this.status = status;
        this.timestamp = new Date();
    }

    public QueueMessage(String exchange, String queueName, Integer type, Integer group, Date timestamp, String message, Integer status, int retry, int maxRetry) {
        super();
        this.queueName = queueName;
        this.type = type;
        this.exchange = exchange;
        this.group = group;
        this.timestamp = timestamp;
        this.message = message;
        this.status = status;
        this.retry = retry;
        this.maxRetry = maxRetry;
    }

    private String exchange;//交换机

    private String queueName;//队列

    private Integer type;//类型 ， 主要区分普通消息和延迟消息 ，

    private Integer group;//分组

    private Date timestamp;//时间戳

    private String message;//消息内容

    private Integer status;//状态

    private int retry = 0; //重试次数

    private int maxRetry = 10;//最大次是

    private int seconds = 1;//延迟的秒数
}
